//
//  CustomerServiceViewController.m
//  WE
//
//  Created by apple on 15/11/30.
//  Copyright © 2015年 UNOHACHA. All rights reserved.
//

#import "CustomerServiceViewController.h"
#import "Size.h"
#import "ToolUtil.h"
#import "UploadPhotosView.h"
@interface CustomerServiceViewController ()<UITextViewDelegate>
@property (nonatomic, strong)UITextView *textView;
@end

@implementation CustomerServiceViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor colorWithRed:229/255. green:229/255. blue:229/255. alpha:1.0];
    // Do any additional setup after loading the view.
    UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 74, WindowWidth, 200)];
    view.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:view];
    
    
    self.navigationItem.title = @"微医客服";
    self.view.backgroundColor = [UIColor colorWithRed:229/255. green:229/255. blue:229/255. alpha:1.0];
   self.textView = [[UITextView alloc] initWithFrame:CGRectMake(8, 0,WindowWidth - 16 , 100)];
    self.textView.backgroundColor = [UIColor whiteColor];
    self.textView.font = FONT(14);
    self.textView.text = @"请详细描述您遇到的问题,如是账号或预约问题,请打客服联系电话";
    _textView.textColor = [UIColor grayColor];
    self.textView.textAlignment = NSTextAlignmentNatural;
    self.textView.delegate = self;
    
    [view addSubview:self.textView];
    
    [ToolUtil createLine:105 superView:view lift:8 width:WindowWidth- 16 hight:1 color:[UIColor grayColor]];
    
    UploadPhotosView *upload = [[UploadPhotosView alloc] initWithFrame:CGRectMake(0, 106, WindowWidth, 94)];
    [view addSubview:upload];
    
    UILabel *hintLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 290, 200, 15)];
    hintLabel.text = @"温馨提醒 :";
    hintLabel.textColor = [UIColor blueColor];
    hintLabel.backgroundColor = [UIColor colorWithRed:229/255. green:229/255. blue:229/255. alpha:1.0];
    [self.view addSubview:hintLabel];
    UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(10, 320, WindowWidth- 20, 60)];
    label.numberOfLines = 3;
    label.font = FONT(14);
    label.text = @"客服工作时间 : 周一至周五9点至17点 (法定节假日除外) 我们会在收到您反馈后1-2个工作日内给予回复, 请耐心等待";
    label.textColor = [UIColor blackColor];
    label.backgroundColor = [UIColor colorWithRed:229/255. green:229/255. blue:229/255. alpha:1.0];
    [self.view addSubview:label];
    
    UIButton *loginButton = [UIButton buttonWithType:UIButtonTypeCustom];
    loginButton.frame = CGRectMake(5, 400, WindowWidth - 10, 40*Height);
    loginButton.layer.masksToBounds = YES;
    loginButton.layer.cornerRadius = 4;
    [loginButton setTitle:@"提交" forState:UIControlStateNormal];
    [loginButton addTarget:self action:@selector(pressLoginButton) forControlEvents:UIControlEventTouchUpInside];
    loginButton.backgroundColor = [UIColor blueColor];
    [loginButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [self.view addSubview:loginButton];
    
}
- (void)viewWillAppear:(BOOL)animated
{
    self.navigationController.navigationBar.hidden = NO;
    
}

- (void)pressLoginButton{
    
}

- (BOOL)textViewShouldBeginEditing:(UITextView *)textView{
    
    if ([textView.text isEqualToString:@"请详细描述您遇到的问题,如是账号或预约问题,请打客服联系电话"]) {
        textView.textColor = [UIColor blackColor];
         textView.text = nil;
    }
   
    return YES;
}

- (BOOL)textViewShouldEndEditing:(UITextView *)textView{
    
    if (textView.text == nil) {
        textView.text = @"请详细描述您遇到的问题,如是账号或预约问题,请打客服联系电话";
    }
    
    
    return YES;
}

- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
    [self.textView resignFirstResponder];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
